package com.avery.imp;

import java.util.List;

import org.mybatis.spring.support.SqlSessionDaoSupport;

import com.avery.dao.IEducationLevelDao;
import com.avery.entity.Educationlevel;

public class EducationLevelDaoImp extends SqlSessionDaoSupport implements IEducationLevelDao {

	public void insert(Educationlevel educationLevel) {
		getSqlSession().insert("EducationLevel.insert", educationLevel);
	}

	public List<Educationlevel> getAllEducationlevel() {
		List<Educationlevel> levels = getSqlSession().selectList("EducationLevel.selectAll");
		return levels;
	}

	public int getEducationlevelIDByName(String name) {
		Educationlevel level = getSqlSession().selectOne("EducationLevel.getByName",name);
		return level==null?-1:level.getId();
	}

}
